{% extends 'layout.html' %}
{% load color %}
{% load permission %}
{% load static %}

{% block content %}
    <div class="table">

        {% include 'include/search_group.html' %}

        <div class="right">
            <form class="form-inline" method="get">
                <div class="form-group">
                    <input name="keyword" type="text" class="form-control" placeholder="请输入关键字"
                           value="{{ keyword }}">
                </div>
                <button type="submit" class="btn btn-default">
                    <span class="glyphicon glyphicon-search"></span>
                </button>
            </form>
        </div>

        <table class="table table-bordered">
            <thead>
            <tr>
                <th>ID</th>
                <th>用户</th>
                <th>类型</th>
                <th>金额</th>
                <th>订单号</th>
                <th>时间</th>
                <th>备注</th>
            </tr>
            </thead>
            <tbody>
            {% for item in pager.sub_queryset %}
                <tr row-id="{{ item.id }}">
                    <th scope="row">{{ item.id }}</th>
                    <td>{{ item.customer.username }}</td>
                    <td>
                        <button class="btn btn-xs btn-{{ item.charge_type|color }}">{{ item.get_charge_type_display }}</button>
                    </td>
                    <td>{{ item.amount }}</td>
                    <td>
                        {% if item.order_oid %}
                            {{ item.order_oid }}
                        {% else %}
                            -
                        {% endif %}
                    </td>
                    <td>{{ item.create_time|date:'Y-m-d' }}</td>
                    <td>
                        {% if item.memo %}
                            {{ item.memo }}
                        {% else %}
                            -
                        {% endif %}
                    </td>
                </tr>
            {% endfor %}
            </tbody>
        </table>


        <nav aria-label="Page navigation">
            <ul class="pagination">
                {{ pager.html }}
            </ul>
        </nav>
    </div>
{% endblock %}

{% block js %}
{% endblock %}
